/**
 * 
 */
package vn.smartware.co.server.dao.factory;

import java.sql.Connection;

import vn.smartware.co.framework.bean.LoginDTO;
import vn.smartware.co.framework.exception.ServerException;
import vn.smartware.co.framework.form.LoginForm;

/**
 * AbstractLoginDAO
 * @author thuctt
 */
public abstract class AbstractLoginDAO {

	/**
	 * check login name exist
	 * 
	 * @param form
	 * @param conn
	 * @return boolean
	 * @throws ServerException
	 */
	abstract public boolean chkUserNameExist(LoginForm form, Connection conn) throws ServerException;
	
	/**
	 * check account exist
	 * 
	 * @param form
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void getLoginInfo(LoginForm form, Connection conn) throws ServerException;

	/**
	 * increase trying number if login error
	 * 
	 * @param form
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void increaseTryNumber(LoginForm form, Connection conn)
			throws ServerException;

	/**
	 * reset trying number to 0
	 * @param form
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void updateLoginSucessfulStatus(LoginForm form, Connection conn)
			throws ServerException;

	/**
	 * get user login info
	 * 
	 * @param form
	 * @param conn
	 * @return LoginForm
	 * @throws ServerException
	 */
	abstract public LoginForm getUserInfo(LoginForm form, Connection conn)
			throws ServerException;

	/**
	 * count login number
	 * 
	 * @param form
	 * @param conn
	 * @return int
	 * @throws ServerException
	 */
	abstract public int countLoginTryNumber(LoginForm form, Connection conn)
			throws ServerException;

	/**
	 * create first login time
	 * 
	 * @param form
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void createFirstLoginTime(LoginForm form, Connection conn)
			throws ServerException;

	/**
	 * lock account
	 * @param form
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void lockAccount(LoginForm form, Connection conn)
			throws ServerException;

	/**
	 * check account locked
	 * @param form
	 * @param conn
	 * @return String
	 * @throws ServerException
	 */
	abstract public String isAccountLocked(LoginForm form, Connection conn)
			throws ServerException;

	/**
	 * reset login status
	 * @param form
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void resetLoginStatus(LoginForm form, Connection conn)
			throws ServerException;

	/**
	 * get max login no
	 * @param conn
	 * @return int
	 * @throws ServerException
	 */
	abstract public int getMaxLoginNo(Connection conn) throws ServerException;

	/**
	 * update logout time
	 * @param user
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void setLogoutTimer(LoginDTO user, Connection conn)
			throws ServerException;

}
